<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    #box {
      width: 200px;
      height: 200px;
      background-color: rgb(228, 139, 139);
      margin: 20px auto;
    }
    .ani1-enter-from{
      transform: translateX(-500px) rotate(360deg) scale(0.1);
      opacity: 0;
    }
    .ani1-leave-to {
      transform: translateY(500px) rotate(-360deg) scale(0.1);
      opacity: 0;
    }
    .ani1-enter-active, .ani1-leave-active{
      transition: all 1s;
    }
  </style>
</head>

<body>
  <div id="app">
    <button @click="isShow=!isShow">{{isShow?'显示':'隐藏'}}</button>
    <transition name="ani1">
      <div id="box" v-if="isShow"></div>
    </transition>
  </div>
  <script src="./vue.global.js"></script>
  <script>
    const { createApp, h } = Vue;
    const app = createApp({
      data() {
        return {
          isShow: true
        }
      },
    });
    app.mount('#app')
  </script>
</body>

</html>